/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kuliza.app.webapp.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.kuliza.app.service.GenericManager;
import com.kuliza.app.model.Student;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 *
 * @author Gaurav Gupta
 */
public class StudentController implements Controller {

    private final Log log = LogFactory.getLog(StudentController.class);
    private GenericManager<Student, Long> studentManager = null;

    public void setStudentManager(GenericManager<Student, Long> studentManager) {
        this.studentManager = studentManager;
    }

    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        
        log.debug("entering 'handleRequest' method...");
        return new ModelAndView().addObject(studentManager.getAll());
        
    }
    

}
